package com.capt_4;

import java.util.ArrayList;

public class Answer {
    private ArrayList<Integer> list = new ArrayList<>();
    private int index = 0;

    public Answer() {

    }

    public ArrayList<Integer> getList() {
        return list;
    }

    public void setList(ArrayList<Integer> list) {
        this.list = list;
    }

    public int getIndex() {
        return index;
    }

    public void setIndex(int index) {
        this.index = index;
    }

    // 清空集合
    public void reset(){
        list.clear();
        index = 0;
    }

    public void add(int answer){
        list.add(answer);
    }


    public boolean hasNext(){
        return index<list.size();
    }

    public int next(){
        int a=-1;
        if (hasNext()){
            a = list.get(index);
            index++;
        }

        return a;
    }
    public int get(int index){
//        获取答案
//        System.out.println(list.get(1));
//        System.out.println(list.size());
        return list.get(index);
    }
    public void set(int index,int newAnswer){
        list.set(index,newAnswer);
}

}
